# -*- coding: utf-8 -*-


import time

from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.maximize_window()
driver.get('https://juejin.cn/')
time.sleep(2)
# 点击元素
driver.find_element(By.XPATH, '//div[@class="entry-list list"]/li[2]').click()
driver.switch_to.window(driver.window_handles[1])

# 获取elements内容
print(driver.page_source) # 获取到的是首页的内容，鼠标聚焦还是在首页
